﻿using DataAccess.DTO;
using DataAccess.Models;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using XYD.DataAccess;
using XYD.Framework.Data;
using XYD.Framework.Data.Dapper;

namespace DataAccess.DAL
{
    public class DTKItemDAL : BaseDAL
    {
        public DTKItem Get(int id)
        {
            return CONN_TopicSharing.Get<DTKItem>(id);
        }

        public bool Insert(DTKItem DTKItem)
        {
            return CONN_TopicSharing.Insert<DTKItem>(DTKItem);
        }

        public bool Update(DTKItem DTKItem)
        {
            return CONN_TopicSharing.Update<DTKItem>(DTKItem);
        }
 
        public List<DTKItem> ListPage(string strWhere, string orderbys, int pagesize, int pageindex, out int count)
        {
            List<DTKItem> DTKItem = new List<DTKItem>();
            if (string.IsNullOrEmpty(strWhere))
            {
                strWhere = " 1=1 ";
            }

            if (string.IsNullOrEmpty(orderbys))
                orderbys = " ID desc ";

            DTKItem = CONN_TopicSharing.SQLPager<DTKItem>("*", " DTKItem ", strWhere, "", "", orderbys, pagesize, pageindex, out count, null).ToList();

            return DTKItem;
        }
    }
}
